package com.testcolision.simulation;

import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector3;

public class RaycastWheel {

	public static final int WHEEL_STATE_GROUND = 0;
	public static final int WHEEL_STATE_AIR = 1;

	public float state = WHEEL_STATE_AIR;

	public float wheelTorque, wheelSpeed, wheelInertia;
	public float integratedSpeed;	
	public float integratedTorque;	
	public Vector3 intersectionPoint = new Vector3();
	public Vector3 collisionNormal = new Vector3();
	public Vector3 frontVec = new Vector3(0,0,-1);
	public Vector3 sideVec = new Vector3(1,0,0);
	public Vector3 upVec = new Vector3(0,1,0);
	
	public Matrix4 rotationMatrix = new Matrix4();
	public RaycastWheel(float radius) {

		wheelInertia = radius*radius;
	}


	public void setSteeringAngle(float steerAngle) {
		rotationMatrix.setToRotation(upVec, steerAngle * MathUtils.radiansToDegrees);
		frontVec = new Vector3(0, 0, -1).rot(rotationMatrix);
		sideVec = new Vector3(1, 0, 0).rot(rotationMatrix);
	}
}
